<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var op = prompt("1.加法，2。减法");
        var one = prompt('第一个数字');
        one = parseFloat(one);
        var two = prompt('第二个数字');
        two = parseFloat(two);

        function jsq(op, one, two) {
            if (op == 1) {
                return one + two
            } else {
                return one - two;
            }
        }
        alert('结果为：' + jsq(op, one, two));
    </script>
</body>

</html>